package com.eastfair.builder.enumeration;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * 展位保证金和管理费缴纳状态
 *
 * @author dqq
 * @date 2023 /6/6
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum SiteBondManageStatus implements BaseEnum {

    /**
     * NOT_PAY="未付款"
     */
    NOT_PAY("未付款"),
    /**
     * HAS_PAY="已付款"
     */
    HAS_PAY("已付款"),
    /**
     * PARTIAL_PAY="部分付款"
     */
    PARTIAL_PAY("部分付款"),
    /**
     * 已取消
     */
    CANCEL("已取消"),
    ;
    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static SiteBondManageStatus match(String val, SiteBondManageStatus def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static SiteBondManageStatus get(String val) {
        return match(val, null);
    }

    public boolean eq(SiteBondManageStatus val) {
        return val != null && eq(val.name());
    }

    @Override
    public String getCode() {
        return this.name();
    }

}